package graphicUserInterface;

import graphicUserInterface.mainInterface.MainWindows;


/**
 * Class design to handle all the HINB 's GUI activity 
 * Note : this class is a thread Safe Singleton
 * note : the previous statement is true as long as we don't need
 * to have all the other parts instanciate...
 */
public class HINBsUserInterfaceThread extends Thread {
	/* *********************************************************
	 * Attributs
	 * ********************************************************* */
	private static HINBsUserInterfaceThread instance = new HINBsUserInterfaceThread();
	private MainWindows _HINBGUI;
	private boolean _running;
	/* *********************************************************
	 * Constructor(s)
	 * ********************************************************* */
	/**
	 * default constructor 
	 * Note : it calls the startMethod when it's done
	 */
	private HINBsUserInterfaceThread(){
		super();
		System.out.println("GUI:HINBsUserInterfaceThread thread creation...");
		//TODO diplay a loading screen here ...
		//_engine = new ...
		_HINBGUI = new MainWindows();
		_HINBGUI.setVisible(true);
		this._running = true;
		this.start();
	}
	
	/* *********************************************************
	 * Instance Methods
	 * ********************************************************* */
	@Override
	public void run() {
		System.out.println("GUI:HINBsUserInterfaceThread running !");
		super.run();
		while(_running){
			//nothing to do for now ...
		}
		System.out.println("See you next time");
		System.out.println("and like VGDE said : \"au refvoir\"");
	}
	/**
	 * Method called to stop the HINBsUserInterfaceThread :
	 * ask the thread to stop as soon as possible.
	 */
	public void stopASAP(){
		this._running = false;
	}
	/* *********************************************************
	 * Static Methods
	 * ********************************************************* */
	public static HINBsUserInterfaceThread getInstance(){
		System.out.println("GUI:HINBsUserInterfaceThread singletion getInstance()");
		return instance;
	}
}
